/*
 * copyright (c) 2009 Alexandr [Sn@ble] Surnin
 *
 * This file is part of FrameSeeker.
 *
 * FrameSeeker is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FrameSeeker is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You can read the full version of GNU LGPL in
 * http://www.gnu.org/copyleft/lesser.html
 */


#ifndef FSMETHODHIST_H
#define FSMETHODHIST_H


#include "FSCoreMethod.h"
#include "FSFrame.h"
#include "FSHist.h"

#include <QDebug>
#include <QSettings>


/** A "histogram method" class
  * Calculate diffs and decide what frame to save
  * \author Alexandr [Sn@ble] Surnin
  */
class FSMethodHist : public FSCoreMethod {
    Q_OBJECT
public:
    FSMethodHist();

public slots:

    /** Process given frames
      * \note Here we deciding save or not current frame :-)
      */
    void process();


    void readSettings(QSettings *settings);

private:

    /** Calculate histogram differnces
      * \note Here is only calculations
      * \return Sum of differences
      */
    quint64 calcHistDiff();


    static quint64 thresholdLow;
    static quint64 thresholdHigh;

    FSHist prevHist;
    FSHist currentHist;
    //FSHist nextHist;
};

#endif // FSMETHODHIST_H
